package com.suray.wcs.service.system.bo;

public class PageBO {
    private long currentPage;
    private long pageSize;
    private long totalCount;
    private long totalPage;

    public long getCurrentPage() {
        if(currentPage < 1){
            currentPage = 1;
        }
        return currentPage;
    }

    public void setCurrentPage(long currentPage) {
        this.currentPage = currentPage;
    }

    public long getPageSize() {
        if(pageSize < 1) {
            pageSize = 20;
        }
        return pageSize;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public long getStartNum() {
        if(currentPage < 1){
            currentPage = 1;
        }
        if(pageSize < 1) {
            pageSize = 20;
        }
        return (currentPage - 1) * pageSize;
    }

    public long getTotalPage() {
        totalPage = getTotalCount() % getPageSize() == 0 ? getTotalCount() / getPageSize() : getTotalCount() / getPageSize() + 1;
        return totalPage;
    }

}
